/**
 * Created by Administrator on 2019/5/18/018.
 */
import CZML_GENERALTOOLS_CLASS from "./../main/CZML_GENERALTOOLS_CLASS.js"

class CZML_CircleOrOval {
  constructor(viewer, id, name, point, semiMinorAxis, semiMajorAxis, rotation, fillColor, isFilled, isOutline, outlineColor) {
    this._viewer = viewer
    this.id = id
    this.name = name
    this.points = point
    this.semiMinorAxis = semiMinorAxis
    this.semiMajorAxis = semiMajorAxis
    this.rotation = rotation
    this.fillColor = fillColor
    this.isFilled = isFilled
    this.isOutline = isOutline
    this.outlineColor = outlineColor
    this.Circles = {
      id: id,
      name: name,
      position: {
        cartographicDegrees: point
      },
      ellipse: {
        show: true,
        rotation: Cesium.Math.toRadians(rotation),
        semiMinorAxis: semiMinorAxis,
        semiMajorAxis: semiMajorAxis,
        height: 0,
        material: {
          solidColor: {
            color: {
              rgba: fillColor
            }
          }
        },
        fill: isFilled,
        outline: isOutline,
        outlineColor: {
          rgba: outlineColor
        }
      }
    }

    this.CZML_AddCircleOrOval()
  }

  CZML_AddCircleOrOval() {
    // 插入该数据对象
    const ret = CZML_GENERALTOOLS_CLASS.InsertModelObjectInformation(this.id, this.Circles, true)
    // 上图
    CZML_GENERALTOOLS_CLASS.Upper(this._viewer)
    return ret
  }
}

export default CZML_CircleOrOval
